<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<c:set var="basePath" value="${pageContext.request.contextPath}" scope="page"></c:set>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>初级审核数据展示页面</title>

 <%@ include file="../../jsp/common.jsp" %> 
 
 <script type="text/javascript" >
	var url;
	
	function searchUser(){
		$("#dg").datagrid('load',{
			"userName":$("#s_userName").val()
		});
	}
	
	
	//增加用户
	function openUserAddDialog(){
		$("#dlg").dialog("open").dialog("setTitle","添加用户信息");
		url="${basePath}/saveUser";
	}
	
	
	function saveUser(){
		$("#fm").form("submit",{
			url:url,
		  	onSubmit:function(){
			 
				return $(this).form("validate");
			},  
			success:function(result){
				if(result){
					$.messager.alert("系统提示","保存成功");
					resetValue();
					$("#dlg").dialog("close");
					$("#dg").datagrid("reload");
				}else{
					$.messager.alert("系统提示","保存失败");
					return;
				}
			}
		});
	}
	
//	删除申请用户
	function deleteUser(){
		var selectedRows=$("#dg").datagrid('getSelections');
		if(selectedRows.length==0){
			$.messager.alert("系统提示","请选择要删除的数据！");
			return;
		}
		var strIds=[];
		var accounts = [];
		for(var i=0;i<selectedRows.length;i++){
			//迭代选中行中的ID
			strIds.push(selectedRows[i].id);
			accounts.push(selectedRows[i].account);
			
		}
		var ids=strIds.join(",");
		var accs=accounts.join(",");
		$.messager.confirm("系统提示","您确认要删除这<font color=red>"+selectedRows.length+"</font>条数据吗？",function(r){
			if(r){
				$.post("${basePath}/deleteUserApply/"+accs,
						{ids:ids},
						{accs:accs},
						function(result){
					if(result){
						
						$.messager.alert("系统提示","数据已成功删除！");
						$("#dg").datagrid("reload");
					}else{
						$.messager.alert("系统提示","数据删除失败！");
					}
				},"json");
			}
		});
		
	}
	
//	修改用户数据
	function openUserModifyDialog(){
		var selectedRows=$("#dg").datagrid('getSelections');
		
		if(selectedRows.length!=1){
			$.messager.alert("系统提示","请选择一条要编辑的数据！");
			return;
		}
		var row=selectedRows[0];
		var userId = row.userId;
		$("#dlg").dialog("open").dialog("setTitle","编辑用户信息");
		$('#fm').form('load',row);
		//url="${basePath}/updateUser/";
		url="${basePath}/updateUser/"+userId;
	}
	
	//重置数据
	function resetValue(){
	}
	
	function closeUserDialog(){
		$("#dlg").dialog("close");
		resetValue();
	}
	 
 </script>
 
</head>
<!-- 动态加载后台数据 -->
<body style="margin:1px;">
	<table id="dg" title="初级审核" class="easyui-datagrid"
	 fitColumns="true" pagination="true" rownumbers="true"
	 url="${basePath}/listBasicCheckDate" singleSelect="true" fit="true" toolbar="#tb">
	 <thead>
	 	<tr>
	 	<th field="cb" checkbox="true" align="center"></th>
	 		<th field="name" width="5" align="center" sortable="true">车主姓名</th>
	 		<th field="mobile" width="5" align="center" sortable="true">电话</th>
	 		<th field="platenumbers" width="5" align="center" sortable="true">车牌号</th>
	 		<th field="vehicle" width="5" align="center" sortable="true">车型</th>
	 		<th field="account" width="5" align="center" sortable="true">上传人</th>
			<th field="product" width="5" align="center" sortable="true">产品类型</th>
			<th field="genre" width="5" align="center" sortable="true">产品期限</th>
			<th field="identification" width="5" align="center" sortable="true">身份证</th>
			<th field="ima0201"  width="5" align="center" sortable="true">申请表照片</th>
			<th field="credit" width="5" align="center" sortable="true">征信</th>
			<th field="img0104" width="5" align="center" sortable="true">行驶证</th>
			<th field="img01P5" width="5" align="center" sortable="true">行驶证2</th>
	 	</tr>
	 </thead>
	</table>
	
	<div id="tb">
		<a class="easyui-linkbutton"  onclick="javascript:basiCheck()"  iconCls="icon-table" plain="true" >照片查看</a>
		<a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="javascript:addBasiCheck()">添加</a>
	</div>

	
	<!-- 保存用户界面 end-->
	<div id="dlg-buttons">
		<a href="javascript:saveUser()" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
		<a href="javascript:closeUserDialog()" class="easyui-linkbutton" iconCls="icon-cancel">关闭</a>
	</div>
	
	 <%@ include file="./showBasicImag.jsp" %> 
	  <%@ include file="./addBasiCheck.jsp" %> 
	 
</body>
</html>